/**
 *  Desc:   新闻管理中心
 *  Author: 刘玉峰
 *  Date:   2020-12-08 17:07
 */

import request from "@/utils/request";
import { removeEmptyKeys } from "@/utils/utils";

// 获取流程列表
export async function fetchList(params) {
  params = removeEmptyKeys(params);
  return request.post(`/api/admin/news/1`, {
    params
  });
}

// 获取流程信息（编辑页用）
export async function loadNewsDetail(id) {
  return request.get(`/api/admin/newsDetail/${id}`);
}


// 更新流程信息
export async function updateFlowInfo(params) {
  params = removeEmptyKeys(params);
  const { id } = params;

  return request(`/api/admin/newsEdit/${id}`, {
    method: "POST",
    data: params
  });
}

// 新增流程信息
export async function addNews(params) {
  params = removeEmptyKeys(params);

  return request(`/api/admin/newsAdd`, {
    method: "POST",
    data: params
  });
}

// 删除
export async function deleteNews(id) {
  return request(`/api/admin/newsDelete/${id}`, {
    method: "GET",
  });
}

